import { stateResp } from "./robot";

export interface IJtPos {
    p1: number;
    p2: number;
    p3: number;
    p4: number;
    p5: number;
    p6: number;
}

export interface ITlPos {
    x: number;
    y: number;
    z: number;
    rx: number;
    ry: number;
    rz: number;
}

export interface IPos {
    jt: IJtPos,
    tl: ITlPos,
}

export interface NamedPos extends IPos {
    name: string,
}

export interface Gripper {
    pos: number,
    speed: number,
    tor: number,
}

export interface Linkage {
    name: string,
    gripper: Gripper,
    pos_list: IPos[],
}

export class JtPos implements IJtPos {
    p1 = stateResp.value.jt_cur_pos0;
    p2 = stateResp.value.jt_cur_pos1;
    p3 = stateResp.value.jt_cur_pos2;
    p4 = stateResp.value.jt_cur_pos3;
    p5 = stateResp.value.jt_cur_pos4;
    p6 = stateResp.value.jt_cur_pos5;
}

export class TlPos implements ITlPos {
    x = stateResp.value.tl_cur_pos0;
    y = stateResp.value.tl_cur_pos1;
    z = stateResp.value.tl_cur_pos2;
    rx = stateResp.value.tl_cur_pos3;
    ry = stateResp.value.tl_cur_pos4;
    rz = stateResp.value.tl_cur_pos5;
}

export class JtTor {
    p1 = stateResp.value.jt_cur_tor0;
    p2 = stateResp.value.jt_cur_tor1;
    p3 = stateResp.value.jt_cur_tor2;
    p4 = stateResp.value.jt_cur_tor3;
    p5 = stateResp.value.jt_cur_tor4;
    p6 = stateResp.value.jt_cur_tor5;
}

export class Pos implements IPos {
    jt = new JtPos();
    tl = new TlPos();
}



